<%= render 'menu/caidau'%>
<p style="color: red"><%= label_tag params[:alert] %></p>
<p style="color: green"><%= label_tag params[:alert1] %></p>
<div align="center">
	
	Status: 
	<%= link_to 'Order', :action=>"history", :s => 'Order'%> 
	<%= link_to 'Borrowed', :action=>"history", :s => 'damuon'%> 
	<%= link_to 'Borrowing', :action=>"history", :s => 'dangmuon'%>
	<br/><br/>
	<table class="vienxanh">
		<tr>
			
			<th>
				BookName
			</th>
			
			
			<th>
				Borrow Date	
			</th>
			<% if @status=='' %>
			<th>
				Delete
			</th>
			<%end%>
			<% if @status=='Order' %>
			<th>
				Deadline	
			</th>
			<th>
				Delete
			</th>
			<%end%>
			<% if @status=='damuon'%>
			<th>
				Return Date
			</th>
			<%end%>
			<% if @status=='dangmuon'%>
			<th>
				Deadline	
			</th>
			<th>
				Extend	time
			</th>
			<th>
				Extend	
			</th>
			
			<%end%>
		</tr>	
<% @listall.each do |l| %>

	<% if(l.Status==@status)%>
		
		<tr>
			
			<% @book = Book.find_by_id(l.Bid) %>
			<td><%= @book.Name%></td>
			
			
			<td>
				<%=l.Borrow_date.strftime("%d-%m-%Y") %>	
			</td>
			<% if @status=='Order' %>
			<td><%= l.Deadline.strftime("%d-%m-%Y")%> </td>
			<td> <%= link_to 'Delete', :o=>l.id, :action=>'xoaorder'%>  </td>
			<%end%>
			<% if @status=='damuon'%>
			<td><%= l.Return_date%> </td>
			
			<%end%>
			
			<% if @status=='dangmuon'%>
			
				<td><%= l.Deadline.strftime("%d-%m-%Y")%> </td>	
				
				<td><%= l.isExtend %></td>
				<td> <%= link_to 'Extend', :o=>l.id, :action=>'extend'%>  </td>
			<%end%>
		<tr>
	<%end%>
<% end %>
</table>
</div>
